//
//  PhotoCompetitionCell.m
//  SXH
//
//  Created by Ryan on 15/12/3.
//  Copyright © 2015年 lyss. All rights reserved.
//

#import "PhotoCompetitionCell.h"
#define CellType_photographer_teach @"photographer_teach"   //摄影大师教学

@implementation PhotoCompetitionCell

- (void)awakeFromNib {
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {


    }
    return self;
}

- (void)layoutSubviews
{
    self.backgroundColor = [UIColor clearColor];
    UITapGestureRecognizer *lefttap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imageViewtap:)];
    [self.leftImgView addGestureRecognizer:lefttap];
    self.leftImgView.userInteractionEnabled = YES;
    self.leftImgView.tag = 0;
    
    
    UITapGestureRecognizer *righttap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imageViewtap:)];
    [self.rightImgView addGestureRecognizer:righttap];
    self.rightImgView.userInteractionEnabled = YES;
    self.rightImgView.tag = 1;
    if ([self.cellType isEqualToString: CellType_photographer_teach])
    {
        self.leftTitle.backgroundColor = [UIColor blackColor];
        self.leftTitle.textAlignment = NSTextAlignmentCenter;
        self.leftTitle.font = [UIFont systemFontOfSize:14];
        self.leftTitle.textColor = [UIColor whiteColor];
        self.leftTitle.alpha = 0.74;
        
        self.rightTitle.backgroundColor = [UIColor blackColor];
        self.rightTitle.textAlignment = NSTextAlignmentCenter;
        self.rightTitle.font = [UIFont systemFontOfSize:14];
        self.rightTitle.textColor = [UIColor whiteColor];
        self.rightTitle.alpha = 0.74;
    }


    
}

- (void)imageViewtap:(UITapGestureRecognizer*)tap
{
    if ([_delegate respondsToSelector:@selector(selectCompetitionPhoto:andType:)])
    {
        [_delegate selectCompetitionPhoto:tap.view.tag andType:self.cellType];
    }
}
- (IBAction)moreDetailClick:(id)sender
{
    if ([_delegate respondsToSelector:@selector(selectMoreDetail:)])
    {
        [_delegate selectMoreDetail:self.cellType];
    }
}
@end
